﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Business;

namespace KhoBanHang
{
    public partial class DangNhap : Form
    {
        NhanVien NVdangNhap;
        public DangNhap()
        {
            InitializeComponent();
        }

        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            string tendn = txtTenDangNhap.Text;

            string matkhau = txtMatKhau.Text;
            NVdangNhap = Business.NhanVien.DangNhap(tendn, matkhau);
            if (NVdangNhap != null) 
            {
                int manv=NVdangNhap.MaNV;

                int quyentmp=NVdangNhap.Quyen;

                @Session.maNV = manv.ToString();
                @Session.quyen = quyentmp.ToString();

                if (MessageBox.Show("Đăng nhập thành công.") == DialogResult.OK) 
                {
                    this.Visible = false;
                    Form home = new Home();
                    home.ShowDialog();
                }                               
            }              
        }

        private void DangNhap_Load(object sender, EventArgs e)
        {

        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
